package com.company.myfirstjmixproject.security;

import com.company.myfirstjmixproject.entity.Department;
import com.company.myfirstjmixproject.entity.User;
import io.jmix.security.role.annotation.JpqlRowLevelPolicy;
import io.jmix.security.role.annotation.RowLevelRole;

import javax.annotation.Nonnull;

@Nonnull
@RowLevelRole(name = "HR manager's department and user", code = "hr-manager-rl")
public interface HrManagerRlRole {


    @JpqlRowLevelPolicy(entityClass = Department.class, where = "{E}.hrManager.id = :current_user_id")
    void department();

    @JpqlRowLevelPolicy(entityClass = User.class, where = "{E}.department.hrManager.id = :current_user_id")
    void user();
}